function E=EL1k_step01(fname)
	% function EL1k_step01(fname)
	% fname = EDF file name (should be absolute)
	% coe@queensu.ca
	
	if nargin==0
		[fname,pathName] = uigetfile({'*.EDF; *.mat'},'please locate an EDF file. (not a edf.mat file)');
		if fname==0
			help(mfilename);
			return
		end
		cd(pathName)
		if ~isempty(strfind(fname,'edf.mat'))
			file already run
			return
        end
    else
        if ~exist(fname,'file')
        error([fname ' does not exist.'])
        end
	end
	tic
	E=el2mat_b2(fname);	
	fprintf('loading %s took: %4.2f seconds\n',fname,toc)
	t=E.sampledata(:,1);
	x=E.sampledata(:,2);x(abs(x)>10000000)=nan;x=(x-(E.res.pix_wide/2));
	y=E.sampledata(:,3);y(abs(y)>10000000)=nan;y=(y-(E.res.pix_high/2));
	a=E.sampledata(:,4);
	%% lab specific
	manual_override=false;
	SEND_SCREEN_METRICS=E.messages(findincell(E.messages,'disttoscreen'));
	if isempty(SEND_SCREEN_METRICS)
		manual_override=true;
	else
		SEND_SCREEN_METRICS=SEND_SCREEN_METRICS{1};
		fred=textscan(SEND_SCREEN_METRICS,repmat('%s %s ',1,(length(findstr(SEND_SCREEN_METRICS,' '))+1)/2));
		for i = 1:2:length(fred)
			eval(['E.res.' lower(char(fred{i})) '=' char(fred{i+1}) ';'])
		end
		if ~isfield(E.res,'swidthinches') || ~isfield(E.res,'disttoscreen')
			manual_override=true;
		end
	end
	if manual_override
		E.res.swidthinches=13;
		E.res.disttoscreen=23;
		disp('couldn''t find SEND_SCREEN_METRICS, using default 13inch screen viewed from 23inches away')
	end
	
	dphs=atan((E.res.swidthinches/2)/E.res.disttoscreen)*180/pi;% degrees per half of a 13inch screen from 23 inches away
	pixperdeg=(E.res.pix_wide/2)/dphs; % pixels per degree
	E.res.ppd=pixperdeg;
	x=x/pixperdeg;
	y=y/pixperdeg;
	%%
	% 	figure(1);clf; hold on
	% 	plot(t,x,'.-c')
	% 	plot(t,y,'.-m')
	% 	plot(t,a/50,'.-','color',[.8 .8 .8])
	starttime=E.mestimes(findincell(E.messages,'TRIAL_START')); %E.messages(starloc),diff(E.mestimes(starloc))
	end_time=E.mestimes(findincell(E.messages,'TRIAL_END')); %E.mestimes(end_loc)

	tic;
	[ct cx cy ca xo yo ao csacloc csac_thresh cblink cspeed]=EL1k_blinkremover_sacdetect_trial_start(t, x, y, a,starttime,end_time, 1,2.5);
	fprintf('blink & saccade took: %4.2f seconds\n',toc)
	E=rmfield(E,'sampledata');% this data is recoverable from t, xo, yo, ao, E.t_adjust, & E.res.ppd
	E.eye.t=ct;
	E.eye.x=cx;
	E.eye.y=cy;
	E.eye.a=ca;
	E.eye.xo=xo; % original
	E.eye.yo=yo; % original
	E.eye.ao=ao; % original
	E.eye.sacloc=csacloc;
	E.eye.sac_thresh=single(csac_thresh);
	E.eye.blink=cblink;
	E.eye.speed=cspeed;
	fname(end-3)='_';
	save([fname '.mat'],'E');
	
end